<p-messages [(value)]="msg"></p-messages>
<div class="content-section implementation GridDemo" id="MalfunctionChange" >
  <div class="title col-sm-12">
    <div class="col-sm-1">
      <span>分配故障单</span>
    </div>
    <div class="col-sm-11 pull-right">
      <button type="button"
              class="pull-right"
              pButton
              [routerLink]="['/index/maintenance/malfunctionBase']"
              icon="fa-close"
              style="width: 30px"></button>
    </div>
  </div>
  <form class="form-horizontal">
    <div class="form-group">
      <label class="col-sm-1 control-label">服务单号：</label>
      <div class="col-sm-3 ui-fluid-no-padding">
        <input type="text" pInputText  placeholder="自动生成"
               [(ngModel)]="malfNumber" readonly
               class=" form-control cursor_not_allowed"
               [ngModelOptions]="{standalone: true}"/>
      </div>
      <label class="col-sm-1 control-label">来源：</label>
      <div class="col-sm-3 ui-fluid-no-padding">
        <input type="text" pInputText  placeholder="自动生成"
               [(ngModel)]="malSource" readonly
               class=" form-control cursor_not_allowed"
               [ngModelOptions]="{standalone: true}"/>
      </div>
      <label class="col-sm-1 control-label">状态：</label>
      <div class="col-sm-3 ui-fluid-no-padding">
        <input type="text" pInputText placeholder="新建"
               [(ngModel)]="malStatus" readonly
               class=" form-control cursor_not_allowed"
               [ngModelOptions]="{standalone: true}"/>
      </div>
    </div>
    <div class="form-group">
      <label class="col-sm-1 control-label">报告人：</label>
      <div class="col-sm-3 ui-fluid-no-padding">
        <input type="text" pInputText  name="" placeholder="请选择报告人"
               [(ngModel)]="reporter.label" readonly   class=" form-control cursor_not_allowed"
               [ngModelOptions]="{standalone: true}"/>
      </div>
      <label class="col-sm-1 control-label">组织：</label>
      <div class="col-sm-3 ui-fluid-no-padding">
        <input type="text" pInputText   class=" form-control cursor_not_allowed"
               placeholder="选择报告人后自动显示" [(ngModel)]="reporter.father" readonly [ngModelOptions]="{standalone: true}"/>
      </div>
      <label class="col-sm-1 control-label">联系电话：</label>
      <div class="col-sm-3 ui-fluid-no-padding">
        <input type="text" pInputText   class=" form-control cursor_not_allowed"
               placeholder="选择人员后自动显示" [(ngModel)]="reporter.remark" readonly [ngModelOptions]="{standalone: true}"/>
      </div>
    </div>
    <div class="form-group">
      <label class="col-sm-1 control-label">受理时间：</label>
      <div class="col-sm-3 ui-fluid-no-padding">
        <input type="text" pInputText  class=" form-control cursor_not_allowed"
               placeholder="选择人员后自动显示" [(ngModel)]="dealTime" readonly [ngModelOptions]="{standalone: true}"/>
      </div>
      <label class="col-sm-1 control-label">发生时间：</label>
      <div class="col-sm-3 ui-fluid-no-padding">
        <input type="text" pInputText  class=" form-control cursor_not_allowed"
               placeholder="选择人员后自动显示" [(ngModel)]="occurTime" readonly [ngModelOptions]="{standalone: true}"/>
      </div>
      <label class="col-sm-1 control-label">最终期限：</label>
      <div class="col-sm-3 ui-fluid-no-padding">
        <input type="text" pInputText placeholder="影响度、紧急度、优先级后自动显示"
               class=" form-control cursor_not_allowed"
               [(ngModel)]="malDeadline" readonly [ngModelOptions]="{standalone: true}"/>
      </div>
    </div>
    <div class="form-group">
      <label class="col-sm-1 control-label">影响度：</label>
      <div class="col-sm-3 ui-fluid-no-padding">
        <input type="text" pInputText class=" form-control cursor_not_allowed"
               placeholder="选择人员后自动显示" [(ngModel)]="malImpact" readonly [ngModelOptions]="{standalone: true}"/>
      </div>
      <label class="col-sm-1 control-label">紧急度：</label>
      <div class="col-sm-3 ui-fluid-no-padding">
        <input type="text" pInputText class=" form-control cursor_not_allowed"
               placeholder="选择人员后自动显示" [(ngModel)]="malUrgency" readonly [ngModelOptions]="{standalone: true}"/>
      </div>
      <label class="col-sm-1 control-label">优先级：</label>
      <div class="col-sm-3 ui-fluid-no-padding">
        <input type="text" pInputText placeholder="选择影响度和紧急度后自动显示"
               class=" form-control cursor_not_allowed"
               [(ngModel)]="malfPrority" readonly [ngModelOptions]="{standalone: true}"/>
      </div>
    </div>
    <div class="form-group">
      <label class="col-sm-1 control-label">故障级别：</label>
      <div class="col-sm-3 ui-fluid-no-padding">
        <input type="text" pInputText class=" form-control cursor_not_allowed"
               placeholder="选择人员后自动显示" [(ngModel)]="malLevel" readonly [ngModelOptions]="{standalone: true}"/>
      </div>
      <label class="col-sm-1 control-label">所属系统：</label>
      <div class="col-sm-3 ui-fluid-no-padding">
        <input type="text" pInputText  name="" placeholder="请选择所属系统"
               [(ngModel)]="belongSystem.label" readonly class=" form-control cursor_not_allowed" [ngModelOptions]="{standalone: true}"/>
      </div>
      <label class="col-sm-1 control-label">发生地点：</label>
      <div class="col-sm-3 ui-fluid-no-padding">
        <input type="text" pInputText  name="department" placeholder="请选择发生地点" class=" form-control cursor_not_allowed"
               [(ngModel)]="locationOccur.label" readonly [ngModelOptions]="{standalone: true}"/>
      </div>
    </div>
    <div class="form-group">
      <label class="col-sm-1 control-label">故障标题：</label>
      <div class="col-sm-11 ui-no-padding-left-15px ">
        <input type="text" pInputText  placeholder="" class=" form-control cursor_not_allowed"
               [(ngModel)]="malTitle" [ngModelOptions]="{standalone: true}" readonly/>
      </div>
    </div>
    <div class="form-group">
      <label class="col-sm-1 control-label">故障描述：</label>
      <div class="col-sm-11 ui-no-padding-left-15px ">
                 <textarea [rows]="5" pInputTextarea autoResize="autoResize" class="form-control cursor_not_allowed"
                           [(ngModel)]="malDesc" [ngModelOptions]="{standalone: true}" readonly></textarea>
      </div>
    </div>

    <div class="form-group">
      <label class="col-sm-1 control-label">上传附件：</label>
      <div class="col-sm-11 ui-fluid-no-padding ">
        <p-fileUpload name="file" url="{{ip}}/workflow/trouble/upload"
                      multiple="multiple"
                      accept="image/*,application/*,text/*"
                      chooseLabel="选择"
                      uploadLabel="上传"
                      cancelLabel="取消"
                      maxFileSize="3145728"
                      (onUpload)="onUpload($event)"
                      (onBeforeUpload)="onBeforeUpload($event)"
                      #form>
          <ng-template pTemplate="content">
            <ul *ngIf="uploadedFiles.length">
              <li *ngFor="let file of uploadedFiles">{{file.name}} - {{file.size}} bytes</li>
            </ul>
          </ng-template>
        </p-fileUpload>
      </div>
    </div>
    <div class="form-group">
      <label class="col-sm-1 control-label">关联服务目录：</label>
      <div class="col-sm-11 ui-no-padding-left-15px ui-fluid">
        <input type="text" pInputText  name="department" placeholder="请选择关联服务目录"
               [(ngModel)]="relativeCategore.label" readonly class=" form-control cursor_not_allowed" [ngModelOptions]="{standalone: true}"/>
      </div>
    </div>
    <div class="form-group">
      <label class="col-sm-1 control-label">关联设备编号：</label>
      <div class="col-sm-11 ui-no-padding-left-15px ui-fluid">
        <input type="text" pInputText  name="department" placeholder="请选择关联设备编号"
               [(ngModel)]="relativeEquip.label" readonly class=" form-control cursor_not_allowed"
               [ngModelOptions]="{standalone: true}"/>
      </div>
    </div>
    <div class="form-group">
      <label class="col-sm-1 control-label">
        <span ngClass="start_red">*</span>
        分配至部门：
      </label>
      <div class="col-sm-5 ui-fluid-no-padding">
        <div class="col-sm-8 ui-fluid ui-fluid-no-padding">
          <input type="text" pInputText  name="department" placeholder="请选择部门"
                 [(ngModel)]="selectedDepartment.label" readonly class="cursor_not_allowed"/>
        </div>
        <div class="col-sm-2 ui-fluid-no-padding ui-padding-10px">
          <button ngClass="ui-g-12 ui-fluid-no-padding" pButton type="button" (click)="showTreeDialog('selectedDepartment')" label="选择"></button>
        </div>
        <div class="col-sm-2 ui-fluid-no-padding ui-padding-10px">
          <button ngClass="ui-g-12 ui-fluid-no-padding" pButton type="button" (click)="clearTreeDialog('selectedDepartment')" label="清空"></button>
        </div>
      </div>
      <label class="col-sm-1 control-label">分配至个人：</label>
      <div class="col-sm-5 ui-fluid-no-padding">
        <p-dropdown [options]="malDepPersonOptions"
                    [(ngModel)]="malDepPerson"
                    placeholder="请选择人员"
                    optionLabel="name"
                    [ngModelOptions]="{standalone: true}"
                    [style]="{'width':'100%'}"></p-dropdown>
      </div>

    </div>
    <div class="form-group">
      <div class="col-sm-12 ui-no-padding-left-15px ui-no-padding-right-15px">
        <button class="pull-right  ui-button-secondary ui-margin-right-10px" pButton type="button" [routerLink]="['/index/maintenance/malfunctionBase']" label="取消" [disabled]="saved"></button>
        <button class="pull-right ui-margin-right-10px" pButton type="button" (click)="submitTrick()" label="提交" [disabled]="hadSaved"></button>
      </div>
    </div>
  </form>
  <p-dialog header="{{ dialogHeader }}" [(visible)]="departementDisplay" modal="modal" width="300" [responsive]="true">
    <p-tree [value]="filesTree4"
            selectionMode="{{ selectedMode }}"
            [(selection)]="selected"
            (onNodeExpand)="nodeExpand($event)"
            (onNodeSelect)="nodeSelect($event)"
    ></p-tree>
    <!--<div>Selected Nodes: <span *ngFor="let file of selected">{{file.label}} </span></div>-->
    <div style="margin-top:8px">Selected Node: {{selected ? selected.label : 'none'}}</div>
    <p-footer>
      <button type="button" pButton icon="fa-check" (click)="closeTreeDialog()" label="确定"></button>
      <button type="button" pButton icon="fa-close" (click)="departementDisplay=false" label="取消"></button>
    </p-footer>
  </p-dialog>
  <p-growl [(value)]="message"></p-growl>
</div>
